//start a clock
//
var sp_0 = 0;
var sp_1 = 0;
//
var status_time;
var time_gone;
var am_pm;
var time_now;
var day_now ;
var month_now ;
var year_now ;
var hours_now;
var hours_mil;
var mins_now;
var secs_now;
var msec_now;
var wday_now;
var wday_new;
var week_day;
var curr_month;
var week_num;
var day_num;
//
var base_time=1000;
var up;
var min1=0;
var min2=0;
var hur1=0;
var hur2=0;
//
var mins_gone;
var hours_gone;
var days_gone;
var month_gone;
//
function show_clock(){
clock_start();
}
//
// Online Help Start
//adapted from Link Description script- www.dynamicdrive.com
var linktext=new Array()
linktext[0]=""
linktext[1]=""

var ns6=document.getElementById&&!document.all
var ie=document.all

function show_text(thetext, whichdiv){
if (ie) eval("document.all."+whichdiv).innerHTML=linktext[thetext]
else if (ns6) document.getElementById(whichdiv).innerHTML=linktext[thetext]
}

function resetit(whichdiv){
if (ie) eval("document.all."+whichdiv).innerHTML=' '
else if (ns6) document.getElementById(whichdiv).innerHTML=' '
}
//  Online Help End
//
//date-time
//
function get_time() {
time_now = new Date();
wday_now = time_now.getDay() + 1;
msec_now = time_now.getTime();
day_now = time_now.getDate();
month_now = time_now.getMonth() + 1;
year_now = time_now.getFullYear();
hours_now = time_now.getHours();
hours_mil = time_now.getHours();
mins_now = time_now.getMinutes();
secs_now = time_now.getSeconds();
if (mins_now < 10)
{
min1 = mins_now;
min2 = 0;
}
else
{
min2 = parseInt(mins_now/10);
min1 = mins_now - (min2 * 10);
}
if (secs_now < 10)
{
sp_0 = secs_now;
sp_1 = 0;
}
else
{
sp_1 = parseInt(secs_now/10);
sp_0 = secs_now - (sp_1 * 10);
}
if(hours_now > 11)
{
am_pm = "PM";
}
else
{
am_pm = "AM";
}
if (hours_now < 10 && hours_now > 0 )
{
hur1 = hours_now;
hur2 = "";
}
else if (hours_now == 0)
{
hur1 = 2;
hur2 = 1;
}
else if ( hours_now > 12)
{
hours_now =  hours_now - 12;
hur2 = parseInt(hours_now/10);
hur1 = hours_now - (hur2 * 10);
if(hur2==0){hur2 = "";}
}
else
{
hur2 = parseInt(hours_now/10);
hur1 = hours_now - (hur2 * 10);
}
//week days
switch(wday_now){
case 1:
week_day="Sunday";
wday_new = 7;
break;
case 2:
week_day="Monday";
wday_new = 1;
break;
case 3:
week_day="Tuesday";
wday_new = 2;
break;
case 4:
week_day="Wednesday";
wday_new = 3;
break;
case 5:
week_day="Thursday";
wday_new = 4;
break;
case 6:
week_day="Friday";
wday_new = 5;
break;
case 7:
week_day="Saturday";
wday_new = 6;
break;
}
//
//month
switch(month_now){
case 1:
curr_month="January";
break;
case 2:
curr_month="February";
break;
case 3:
curr_month="March";
break;
case 4:
curr_month="April";
break;
case 5:
curr_month="May";
break;
case 6:
curr_month="June";
break;
case 7:
curr_month="July";
break;
case 8:
curr_month="August";
break;
case 9:
curr_month="September";
break;
case 10:
curr_month="October";
break;
case 11:
curr_month="November";
break;
case 12:
curr_month="December";
break;
}
//
get_wn();
//
mins_gone = parseInt(100*mins_now/60);
hours_gone = parseInt(100*(hours_mil+(mins_gone/100))/24);
days_gone = parseInt(100*(wday_new-1+(hours_gone/100))/7);
month_gone = parseInt(100*(day_now-1+(hours_gone/100))/31);
//
status_time = "<b>" + hur2 + hur1 + ":" + min2 + min1 + ":" + sp_1 + sp_0 + " - " + am_pm + "</b><br/>" + day_now + " - " + week_day + "<br/>" + curr_month + " - " + year_now + "<h4>" + "Week of Year - " + week_num + "</h4>"; 
time_gone = "<ul><li>" + mins_gone + " % Hour Dribbled</li><li>" + hours_gone +  " % Day Trickled</li><li>" +  days_gone +  " % Week Filled</li><li>" + month_gone +  " % Month Over</li><li>" + parseInt(100*day_num/366) +  " % Year Passed</li></ul>";
linktext[0]=  status_time ;
show_text(0,'status_box');
}
//
// adapted from week number  www.quirksmode.org/js/week.html
function get_wn() {
 	var today = new Date();
	Year = takeYear(today);
	Month = today.getMonth();
	Day = today.getDate();
	now = Date.UTC(Year,Month,Day+1,0,0,0);
	var Firstday = new Date();
	Firstday.setYear(Year);
	Firstday.setMonth(0);
	Firstday.setDate(1);
	then = Date.UTC(Year,0,1,0,0,0);
	var Compensation = Firstday.getDay();
	if (Compensation > 3) Compensation -= 4;
	else Compensation += 3;
	week_num =  Math.round((((now-then)/86400000)+Compensation)/7);
	day_num =  Math.round(((now-then)/86400000)+Compensation);
}
//
//
function takeYear(theDate)
{
 x = theDate.getYear();
 var y = x % 100;
 y += (y < 38) ? 2000 : 1900;
 return y;
}
//  quirksmode week end
//
//
//1 Sec Clock timer
function clock_start() {
up=setTimeout("colon_off();",(base_time/2));
}
function colon_off() {
up=setTimeout("clock_start();",(base_time/2));
get_time();
}
//end sec clock
//
window.onload=show_clock;
//
//end of script